# -*- coding: utf-8 -*-
# @Author   : xiongjianwen
# @Time     : 2022/12/2 10:12
# @File     : pywinauto_demo.py
# @Project  : BwProCost_Auto_v2
import time
from time import sleep

from pywinauto import Application

import pywinauto
# app = Application(backend='uia').connect(process=29356)
#
# bzr = app.window(title='232423.BT1 - 博微技改检修工程计价通T1软件(V1.7.3.121)')
# print(bzr)
# test = bzr.window(class_name='Composite_SWT',auto_id='2755880')
# print(test)
#
# test.draw_outline(colour='green',thickness=2,rect=None)   # 划线
# bzrxx = test.window(class_name='Composite_SWT',auto_id='199172')
# bzrxx.draw_outline(colour='green',thickness=2,rect=None)
# bzrxx_table = bzrxx.window(class_name='ListCtrl')
# bzrxx_table.draw_outline(colour='green',thickness=2,rect=None)
# print(bzrxx_table.texts())
# print(bzrxx_table.PrintControlIdentifiers)
#


# jg_app = Application(backend='uia').start(r'D:\博微软件\技改检修工程计价通T1软件_1.8.1.3701\BT1.exe')
# time.sleep(10)
# login_dlg = jg_app['登录软件']
#
# login_dlg.print_control_identifiers()


app = Application(backend='uia').connect(handle=1902560)

# print(app)
# app.draw_outline(colour='green',thickness=2,rect=None)
lc = app['测试恢复工程.BT1 - 博微技改检修工程计价通T1软件(V1.8.1.370)']

jbcs = lc['基本参数Pane']
# jbcs.print_control_identifiers()
jbcs_gcmc = jbcs.child_window(auto_id="9378766", control_type="Pane")
print(jbcs_gcmc.wrapper_object())
print(dir(jbcs_gcmc.wrapper_object()))
print(jbcs_gcmc.texts())
jbcs_gcmc.print_control_identifiers()
jbcs_gcmc.draw_outline(colour='red',thickness=2,rect=None)
# jbcs_gcmc.child_window(auto_id="700927920", control_type="Pane").print_control_identifiers()
# jbcs_gcmc.child_window(auto_id="700927920", control_type="Pane").draw_outline(colour='green',thickness=2,rect=None)

# jbcs.draw_outline(colour='red',thickness=2,rect=
# {'left':307,'top':510,'right':1107,'bottom':526})